import 'package:flutter/material.dart';

import '../utils/colors.dart';

class GLGradientButton extends StatelessWidget {
  static LinearGradient gradient1 = LinearGradient(begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [AppColors.color_278AFF, AppColors.color_66D6E2]);
  static LinearGradient gradient2 = LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [AppColors.color_66D6E2, AppColors.color_278AFF]);


  final VoidCallback onPressed;
  final Widget child;
  final LinearGradient? gradient;

  const GLGradientButton({
    super.key,
    required this.onPressed,
    required this.child,
    this.gradient
  });

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: BoxConstraints(
        maxHeight: 48,
      ),
      child: LayoutBuilder(
        builder: (ctx, cons) {
          return InkWell(
            onTap: onPressed,
            child: Container(
              decoration: BoxDecoration(
                gradient: gradient ?? GLGradientButton.gradient1,
                borderRadius: BorderRadius.circular(cons.maxHeight * 0.5),
                // boxShadow: [
                //   BoxShadow(
                //     color: Color(0xFFDEE1EF),
                //     offset: Offset(0, 4),
                //     blurRadius: 13.8,
                //     blurStyle: BlurStyle.normal,
                //   ),
                //   BoxShadow(
                //     color: Color(0xFF71D0FF),
                //     offset: Offset(2, 6),
                //     blurRadius: 10,
                //     blurStyle: BlurStyle.normal,
                //   ),
                //   BoxShadow(
                //     color: Color(0x75C8FBFF),
                //     offset: Offset(-4, 5),
                //     blurRadius: 6.5,
                //     blurStyle: BlurStyle.normal,
                //   ),
                // ]
              ),
              child: Center(
                child: Padding(
                  padding: const EdgeInsets.symmetric(horizontal: 12),
                  child: child,
                ),
              ),
            ),
          );
        },
      ),
    );
  }
}


class GLOutLineButton extends StatelessWidget {
  final VoidCallback onPressed;
  final Widget child;
  final Color? outlineColor;

  const GLOutLineButton({
    super.key,
    required this.onPressed,
    required this.child,
    this.outlineColor,
  });

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: BoxConstraints(
        maxHeight: 48,
      ),
      child: LayoutBuilder(
        builder: (ctx, cons) {
          return InkWell(
            onTap: onPressed,
            child: Container(
              decoration: BoxDecoration(
                border: Border.all(
                  color: AppColors.color_8C8C8C,
                  width: 1,
                ),
                borderRadius: BorderRadius.circular(cons.maxHeight * 0.5),
                // boxShadow: [
                //   BoxShadow(
                //     color: Color(0xFFDEE1EF),
                //     offset: Offset(0, 4),
                //     blurRadius: 13.8,
                //     blurStyle: BlurStyle.normal,
                //   ),
                //   BoxShadow(
                //     color: Color(0xFF71D0FF),
                //     offset: Offset(2, 6),
                //     blurRadius: 10,
                //     blurStyle: BlurStyle.normal,
                //   ),
                //   BoxShadow(
                //     color: Color(0x75C8FBFF),
                //     offset: Offset(-4, 5),
                //     blurRadius: 6.5,
                //     blurStyle: BlurStyle.normal,
                //   ),
                // ]
              ),
              child: Center(
                child: Padding(
                  padding: const EdgeInsets.symmetric(horizontal: 12),
                  child: child,
                ),
              ),
            ),
          );
        },
      ),
    );
  }
}
